package es.battleship.model;

import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.xml.bind.annotation.XmlRootElement;

import com.google.appengine.api.datastore.Key;

/**
 * Ship represent a list of cells in the board. There are five different types
 * of ships, the only difference is the number of cell the uses. 
 * 
 * @author mhuertas
 *
 */
@XmlRootElement
@PersistenceCapable
public class Ship {
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key id;

	/**
	 * List of the cell for this Ship.
	 */
	@Persistent	
	private List<Cell> cells;
	

	@Persistent	
	private ShipConfig shipConfig;
	
	

	

	public Key getId() {
		return id;
	}





	public void setId(Key id) {
		this.id = id;
	}





	public List<Cell> getCells() {
		return cells;
	}





	public void setCells(List<Cell> cells) {
		this.cells = cells;
	}

	public ShipConfig getShipConfig() {
		return shipConfig;
	}


	public void setShipConfig(ShipConfig shipConfig) {
		this.shipConfig = shipConfig;
	}


	public String toString() {
		return "Ship { Id: "
				+ id 
				+ " cells: " 
				+ cells
				+ " shipConfig: "
				+ shipConfig 
				+ " } "; 
	}
}


